<template>
	<view>
		<scroll-view class="scroll-view" scroll-y="true" :style="'height:'+scriptHeight+'px'">
			<view class="item" v-for="(item,index) in list" :key="index">
				<view class="num"><view class="num-text">{{item.sort}}</view></view>
				<view class="user">
					<view class="user-avatar"><image class="user-avatar-img" :src="item.avatar" ></image></view>
					<view class="user-nickname">{{item.nickname}}</view>
				</view>
				<view class="score">{{item.score}}</view>
			</view>
			
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				'scriptHeight':400,
				'list':[],
			}
		},
		onReady() {
			this.scriptHeight = uni.getSystemInfoSync().windowHeight;
		},
		onLoad() {
			let that = this;
			uni.request({
				url: that.websiteUrl+'/eg_easy_game_ranking',
				method:'POST',
				header: {
				        'x-requested-with': 'xmlhttprequest' //自定义请求头信息
				    },
				data:{
					// 'openid':that.openid,
				},
				success:(res)=>{
					if(res.data.code != 1){
						uni.showToast({
							title:res.data.msg,
							duration:2000,
							icon:'none',
						})
					} else {
						that.list = res.data.data;
					}
				}
			})
		},
		methods: {
			
		}
	}
</script>

<style lang="scss">
.scroll-view{
	height: 450px;
	background-color: $uni-scroll-bg-clolr;
	.item{
		display: flex;
		margin: 15px 10px;
		height:60px;
		background-color: $uni-bg-color;
		align-items: center;
		font-size: 15px;
		font-weight: bold;
		border-radius: 5px;
		.num{
			width:20%;
			margin-left: 20px;
			.num-text{
				// width:20px;
				// height:20px;
				// border-radius: 50%;
				// background-color:#007AFF;
				color:$uni-primary-color;
			}
		}
		.user{
			display: flex;
			width:50%;
			align-items: center;
			.user-avatar{
				
				.user-avatar-img{
					border-radius: 50%;
					width:30px;
					height:30px;
				}
			}
			.user-nickname{
				font-size: 14px;
				font-weight: bold;
				margin-left: 10px;
				color: $uni-text-color;
			}
		}
		.score{
			width: 30%;
			// background-color: #007AFF;
			margin-right: 20px;
			display: flex;
			justify-content: flex-end;
			color: $uni-primary-color;
		}
	}
}

</style>
